home *** CD-ROM | disk | FTP | other *** search
/ Tech Arsenal 1 / Tech Arsenal (Arsenal Computer).ISO / tek-02 / gsdb25.zip / DB_XPL12.PAS < prev    next >
Pascal/Delphi Source File  |  1990-12-23  |  2KB  |  61 lines

  1. program DB_Xpl12;
  2. uses
  3.    CRT,
  4.    DOS,
  5.    GS_KeyI,
  6.    GS_dBFld,
  7.    GS_dBase;
  8.  
  9. var
  10.    HlthData,
  11.    Health    : GS_dBFld_Objt;
  12.    DumyStr   : string;
  13.  
  14. procedure DisplayRecord;
  15. begin
  16.    HlthData.FieldDisplay('F_CODE','Food Code: ',1,1);
  17.    HlthData.FieldDisplay('L_NAME','Last Name: ',1,2);
  18.    HlthData.FieldDisplay('M_DATE','Date of Meal: ',1,3);
  19.    Health.FieldDisplay('FOOD','Name of Food: ',1,5);
  20.    Health.FieldDisplay('FOOD_CODE','',70,5);
  21.    Health.FieldDisplay('QUANTITY','Quantity: ',1,6);
  22.    Health.FieldDisplay('UNITTYPE','Type of Unit: ',1,7);
  23.    Health.FieldDisplay('CALS','Calories: ',1,8);
  24.    Health.FieldDisplay('TOT_FAT_G','Total Fat: ',1,9);
  25.    Health.FieldDisplay('SAT_FAT_G','Saturated Fat: ',1,10);
  26.    gotoxy(1,11);
  27.    if Health.NumberGet('TOT_FAT_G') > 0.000 then
  28.       write('Percent of Saturated Fat to Total Fat is : ',
  29.          (Health.NumberGet('SAT_FAT_G')*100)/Health.NumberGet('TOT_FAT_G'):5:1)
  30.       else write('':79);
  31.    Health.FieldDisplay('CHOLES_MG','Cholesterol per Mg: ',1,12);
  32.    Health.FieldDisplay('COMMENTS','COMMENTS: ',1,13);
  33. end;
  34.  
  35. begin
  36.    ClrScr;
  37.    GotoXY(1,25);
  38.    write('Press ESC to stop, any other key to continue');
  39.    HlthData.Init('HLTHDATA');
  40.    HlthData.Open;
  41.    Health.Init('HEALTH');
  42.    Health.Open;
  43.  
  44. {                This command may be used to reindex the file}
  45. {   Health.IndexTo('FOODCODE','FOOD_CODE');}
  46.    Health.Index('FOODCODE');
  47.    HlthData.GetRec(Top_Record);
  48.    while (not Health.File_EOF) and (not GS_KeyI_Esc) do
  49.    begin
  50.       if Health.Find(HlthData.StringGet('F_CODE')) then
  51.       begin
  52.          DisplayRecord;
  53.          WaitForKey;
  54.          if GS_KeyI_Chr = Kbd_Esc then GS_KeyI_Esc := true;
  55.       end;
  56.       HlthData.GetRec(Next_Record);
  57.    end;
  58.    Health.Close;
  59.    HlthData.Close;
  60. end.
  61.